package com.ehotting.mqbd.api.bean;

import com.ehotting.mqbd.api.bean.task.TaskStateRequest;
import com.ehotting.mqbd.api.enums.MQDataPushModelEnum;
import com.ehotting.mqbd.api.enums.TopicEnum;
import org.springframework.util.Assert;

public class MQTaskData  extends MQBaseData<TaskStateRequest,TaskStateRequest>{

    private TaskStateRequest request;

    private TaskStateRequest response;

    public MQTaskData() {
        super();
        this.pushModel = MQDataPushModelEnum.ALL_PUSH;
    }


    public MQTaskData(TopicEnum topic, String consumerHost, String localHost, String agentId, String module, String msg) {
        super( topic, consumerHost,  localHost,  agentId,  module,  msg);
        this.pushModel = MQDataPushModelEnum.ALL_PUSH;
    }

    public static MQTaskData create(TopicEnum topic, String consumerHost, String localHost, String agentId, String module, String msg){
        Assert.notNull(topic,"topic is null");
        return new MQTaskData( topic, consumerHost,  localHost,  agentId,  module,  msg);
    }

    public static MQTaskData create(TopicEnum topic,MqApplicationContext mqApplicationContext, String agentId,  String msg){
        Assert.notNull(topic,"topic is null");
        return new MQTaskData( topic, mqApplicationContext.getConsumerHost(),  mqApplicationContext.getLocalHost(),  agentId,  mqApplicationContext.getModule(),  msg);
    }

    @Override
    public TaskStateRequest getRequest() {
        return request;
    }



    public   void  setRequest(TaskStateRequest request) {
        this.request = request;
    }

    @Override
    public TaskStateRequest getResponse() {
        return response;
    }


    public void setResponse(TaskStateRequest response) {
        this.response = response;

    }


}
